<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/6/25
 * Time: 15:24
 */

namespace Admin\Model;


use Common\Model\CommonModel;

class ProductModel extends CommonModel
{
    protected $tableName = 'project';

    public function putaway($id){
        if(empty($id)) return false;

        return $this->where(array('id'=>$id))->setField('is_on',1);
    }

    /**
     * 商品下架
     * @param $id
     * @param $reason
     * @return bool
     */
    public function soldOut($id,$reason){
        if(empty($id) || empty($reason)) return false;

        $data = array();
        $data['is_on'] = 2;
        $data['reason'] = $reason;

        return $this->where(array('id'=>$id))->save($data);
    }
}